<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改拍卖会预展基本资料</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/common.js"></script>
<script src="../js/artDialog.js?skin=gray"></script>
<script src="../js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>

<script type="text/javascript">

$(function(){
	$("#auctionLink").click(function(){
		art.dialog.open('${ctx}/fileUpload!uploadPrepare.do?imgType=auction&sharpId=10',{title:'上传拍卖画册封面图片',width:800,height:550,lock:true},false);
    });

	var city_id = '${auction.cityInfo.id}';
	checkCity(city_id);
});

/**********提交前检查表单*****************/
function checkForm(){

	var name = $.trim($("#name").val());
	if( name  ==  ""){
		$("#name").focus();
		 alert("拍卖会名称不能为空。");
		 return false;
	}

	var planningUnit =  $.trim($("#planningUnit").val());
	if( planningUnit  ==  ""){
		$("#planningUnit").val("");
		$("#planningUnit").focus();
		alert("策展单位不能为空。");
		return false;
	}

	var picImage = $("#picImage").val();
	if( picImage == "" ){
		alert("请上传拍卖画册封面图片");
		return false;
	}

	var totalCount =  $.trim($("#totalCount").val());
	if( totalCount  !=  "" &&  !IsInt(totalCount)){
		$("#totalCount").val("");
		$("#totalCount").focus();
		alert("作品数量不合法。");
		return false;
	}

	var beginningTime =  $.trim($("#beginningTime").val());
	if( beginningTime  ==  ""){
		alert("请填写开拍时间。");
		return false;
	}

	var province = $("#provinceInfoSelect").val();
	if( province == ""){
		 alert("请选择拍卖会所在省。");
		 return false;
	}

	var city = $("#cityInfoSelect").val();
	if( city == ""){
		 alert("请选择拍卖会所在市。");
		 return false;
	}
	
	var address = $.trim($("#address").val());
	if( address  ==  ""){
		$("#address").focus();
		 alert("请填写拍卖详细地址。");
		 return false;
	}

	if(window.confirm("确认修改？")){
		$.ajax({
			type:'POST',
			url:'${ctx }/auction/auctionAction!save_additional.do',
			async : false, //ajax同步
			data:$("#auctionForm").serialize(),//序列化表单里所有的内容
			success: function(data){
			  if(data =='0000'){
	    			alert("保存成功！");
	    			var win = art.dialog.open.origin;//来源页面
					// 如果父页面重载或者关闭其子对话框全部会关闭
					win.location.reload();
					return false;
				}else{
					alert("保存失败！");
					return false;
				}
			}
		});
	}
}
</script>
</head>
<body>

<form action="${ctx }/auction/auctionAction!save_additional.do" method="post" id="auctionForm" name="auctionForm">
<table width="800" align="center" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
      <tr>
        <td bgcolor="#FFFFFF"><table width="800" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td colspan="100%" align="center" class="bt14A">填写预展资料</td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right"><span class="style15">*</span> 拍卖会名称：</td>
            <td valign="top" class="bt14A"><input name="auction.name" type="text" size="35" id="name" value="${auction.name }"  maxlength="40"></td>
            <td width="198" rowspan="8" valign="top" class="bt14A" align="center">
              <table width="165" height="217" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
                <tr>
                  <td bgcolor="#FFFFFF">
                  	   <div id="photoTd" style="width: 165px;height: 217px;vertical-align: middle;text-align: center;overflow: hidden;">
	                    		<img src="${auction.imagepath}">
	                   </div>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right"><span class="style15">*</span> 策划展单位：</td>
            <td valign="top" class="bt14A"><input name="auction.planningUnit" type="text" size="35" id="planningUnit" value="${auction.planningUnit }"></td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right"><span class="style15">*</span>拍卖会画册封面：</td>
            <td valign="top" class="bt14A"><span class="style18"><a id="auctionLink" style="cursor: pointer;color: red">上传</a></span></td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right">封面拍品名称：</td>
            <td valign="top" class="bt14A"><input name="auction.coverName" type="text" size="20" id="coverName" value="${auction.coverName }"></td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right">参拍作品数量：</td>
            <td valign="top" class="bt14A"><input name="auction.totalCount" type="text" size="6" id="totalCount" value="${auction.totalCount }"></td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right"><span class="style15">*</span> 开拍时间：</td>
            <td valign="top" class="bt14A"><input name="auction.beginningTime" value="<fmt:formatDate value='${auction.beginningTime }' pattern='yyyy-MM-dd HH:mm'/>" type="text" size="20" id="beginningTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"></td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right"><span class="style15">*</span> 开拍地点：</td>
            <td valign="top" class="bt14A">
            	<select name="auction.provinceInfo.id" id="provinceInfoSelect" onchange="changeProvince()">
                        <option value="">选择省份</option>
                        <c:forEach items="${provinceInfoList}" var="provinceInfo" varStatus="status">
				             <option value="${provinceInfo.id}" <c:if test="${auction.provinceInfo.id == provinceInfo.id }">selected="selected"</c:if>/> ${ provinceInfo.name}</option>
				        </c:forEach>
                </select>
                <select name="auction.cityInfo.id" id="cityInfoSelect">
                  <option value="">选择县市</option>
                </select>
                <input name="auction.address" type="text" size="40" id="address" value="${auction.address }" maxlength="200">
            </td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right">联系人：</td>
            <td valign="top" class="bt14A"><input name="auction.contact" type="text" size="20" id="contact" value="${auction.contact }"></td>
          </tr>
          <tr>
            <td valign="top" class="bt14A" align="right">咨询电话：</td>
            <td valign="top" class="bt14A"><input name="auction.tel" type="text" size="20" id="tel" value="${auction.tel }">
            	<!-- 隐藏域 begin -->
		            <input name="auction.imageInfo.id" type="hidden"  id="picImage" value="${auction.imageInfo.id }">
		            <input name="auction.id" type="hidden"  id="auction_id" value="${auction.id }">
		        <!-- 隐藏域 end --> 
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td valign="top" class="nw12a"><img src="../images/an24.gif" width="114" height="31" onClick="javascript:checkForm()" style="cursor: pointer ;border: 0"></td>
          </tr>
        </table></td>
      </tr>
</table>
</form>
</body>
</html>